package com.actimize.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;

import com.actimize.dao.AccountDao;
import com.actimize.dao.hibernate.AccountDaoHibernate;
import com.actimize.model.Account;
import com.actimize.service.AccountManager;

public class AccountManagerImpl extends GenericManagerImpl<Account, Long>
		implements AccountManager {
	private AccountDao accountDao;
	
	public AccountManagerImpl(){
		this.accountDao = new AccountDaoHibernate();
	}
	
	@Autowired
    public void setAccountDao(AccountDao accountDao) {
        this.dao = accountDao;
        this.accountDao = accountDao;
        System.out.println("Ucitao sam dao="+this.accountDao.toString());
    }

	public List<Account> getAll() {
		
		return accountDao.getAll();
	}

	public Account get(Long id) {
		return accountDao.get(id);
	}



	public Account save(Account object) {
		return accountDao.save(object);
	}

	public void remove(Long id) {
		accountDao.remove(id);
	}

	public Account getAccount(Long accountId) {
		return accountDao.get(accountId);
	}

	public List<Account> getAccounts(Long userID) {
		return accountDao.getAccountByUserID(userID);
	}

	public Account saveAccount(Account account) {
		return accountDao.saveAccount(account);
	}

	public void removeAccount(Long accountID) {
		log.debug("removing account: " + accountID);
        accountDao.remove(accountID);
	}

	public List<Account> search(String searchTerm) {
		return super.search(searchTerm, Account.class);
	}

}
